package com.jmex.physics.impl.bullet.joints;

import com.jme.math.Vector3f;
import com.jmex.physics.TranslationalJointAxis;

public class BulletTranslationalJointAxis extends TranslationalJointAxis {

	private float availableAcceleration;
	private float desiredVelocity;
	private float positionMinimum=Float.NaN;
	private float positionMaximum=Float.NaN;
	
	private boolean dirty=true;
	
	@Override
	public float getAvailableAcceleration() {
		return availableAcceleration;
	}

	@Override
	public float getDesiredVelocity() {
		return desiredVelocity;
	}

	@Override
	public float getPosition() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public float getPositionMaximum() {
		return positionMaximum;
	}

	@Override
	public float getPositionMinimum() {
		return positionMinimum;
	}

	@Override
	public float getVelocity() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void setAvailableAcceleration(float value) {
		availableAcceleration = value;
		dirty=true;
	}

	@Override
	public void setDesiredVelocity(float value) {
		desiredVelocity = value;
		dirty=true;
	}

	@Override
	public void setPositionMaximum(float value) {
		positionMaximum=value;
		dirty=true;
	}

	@Override
	public void setPositionMinimum(float value) {
		positionMinimum=value;
		dirty=true;
	}

	boolean isDirty()
	{
		return dirty;
	}

	void setDirty(boolean value)
	{
		dirty=value;
	}

	@Override
	public void setDirection(Vector3f direction) {
		super.setDirection(direction);
		if(getJoint()!=null)
			((BulletJoint)getJoint()).setDirty(true);
	}

	@Override
	public void setRelativeToSecondObject(boolean value) {
		super.setRelativeToSecondObject(value);
		if(getJoint()!=null)
			((BulletJoint)getJoint()).setDirty(true);
	}	
}
